package com.hxh.demo.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author 兴趣使然黄小黄
 * @version 1.0
 * @date 2023/7/5 0:13
 */
@Controller
@ResponseBody
@RequestMapping("/user")
public class UserController {

    // 1. 得到日志对象
    private final Logger logger = LoggerFactory.getLogger(UserController.class);

    // 2. 写日志的方法
    @RequestMapping("/hi")
    public String sayHi() {
        // 写日志
        logger.trace("我是 trace");
        logger.debug("我是 debug");
        logger.info("我是 info");
        logger.warn("我是 warn");
        logger.error("我是 error");
        return "Hi, Spring Boot！";
    }
}
